﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GSPatEditor.Pat
{
    class Resources
    {
        public readonly Dictionary<string, string> Paths = new Dictionary<string, string>();

        public Resources()
        {
        }

        public static Resources CreateSingleDirectoryResources(string path)
        {
            var ret = new Resources();
            ret.Paths.Add("default", path);
            return ret;
        }

        public Image GetImageByFileName(string fileName)
        {
            foreach (var p in Paths)
            {
                var fullName = Path.Combine(p.Value, fileName);
                var ret = Image.CreateFromFile(fullName, fileName);
                if (ret != null)
                {
                    return ret;
                }
            }
            return null;
        }
    }
}
